1. Field
Methods and apparatuses consistent with exemplary embodiments of the present application relate to adjusting reconstructed pixel values by offsets determined adaptively to minimize an error between an original image and a reconstructed image in video encoding and decoding operations.
2. Description of Related Art
As hardware for reproducing and storing high resolution or high quality video content is being developed, a video codec is increasingly needed for effectively encoding or decoding the high resolution or high quality video content. According to a conventional video codec, a video is encoded according to a limited encoding method based on a macroblock having a predetermined size.
Image data of the space domain is transformed into coefficients of the frequency domain via frequency transformation. According to a video codec, an image is split into blocks having a predetermined size, discrete cosine transformation (DCT) is performed on each block, and frequency coefficients are encoded in block units, for rapid calculation of frequency transformation. Compared with image data of the space domain, coefficients of the frequency domain are easily compressed. In particular, because an image pixel value of the space domain is expressed according to a prediction error via inter prediction or intra prediction of a video codec, when frequency transformation is performed on the prediction error, a large amount of data may be transformed to 0. According to a video codec, an amount of data may be reduced by replacing data that is consecutively and repeatedly generated with small-sized data.
SUMMARY Aspects of exemplary embodiments relate to signaling of sample adaptive offset (SAO) parameters determined to minimize an error between an original image and a reconstructed image in video encoding and decoding operations.
According to an aspect of an exemplary embodiment, there is provided a sample adaptive offset (SAO) decoding method including obtaining context-encoded leftward SAO merge information and context-encoded upward SAO merge information from a bitstream of a largest coding unit (MCU); obtaining SAO on/off information context-encoded with respect to each color component, from the bitstream; if the SAO on/off information indicates to perform SAO operation, obtaining absolute offset value information for each SAO category bypass-encoded with respect to each color component, from the bitstream; and obtaining one of band position information and edge class information bypass-encoded with respect to each color component, from the bitstream.
The obtaining of the SAO on/off information may include, if the SAO on/off information indicates to perform SAO operation, further obtaining edge band identification information encoded in a bypass mode with respect to each color component, from the bitstream, and context decoding may be performed on the SAO on/off information in a first bin of SAO type information of the MCU, and bypass decoding may be performed on remaining bits of the SAO type information other than the SAO on/off information.
The obtaining of the band position information or the edge class information may include, if the obtained edge band identification information indicates a band type, obtaining the band position information bypass-encoded with respect to each color component, from the bitstream, the obtaining of the band position information may include, if the absolute offset value information obtained for each SAO category is not 0, obtaining the band position information and offset sign information bypass-encoded with respect to each color component, from the bitstream, and the band position information may be lastly obtained from among SAO parameters of the MCU.
The obtaining of the band position information or the edge class information may include, if the obtained edge band identification information indicates an edge type, obtaining the edge class information bypass-encoded with respect to each color component, from the bitstream, and the edge class information may include edge class information for a luma component and edge class information for a first chroma component, and the edge class information for the first chroma component may be equally applied to a second chroma component.
The SAO on/off information and the edge band identification information for a first chroma component may be equally applied to a second chroma component, and the leftward SAO merge information and the upward SAO merge information may be commonly applied to a luma component, and the first and second chroma components of the MCU.
The obtaining of the leftward SAO merge information and the upward SAO merge information may include determining a context-based probability model of the leftward SAO merge information, performing entropy decoding by using the determined probability model of the leftward SAO merge information, and thus reconstructing the leftward SAO merge information; and determining a context-based probability model of the upward SAO merge information, performing entropy decoding by using the determined probability model of the upward SAO merge information, and thus reconstructing the upward SAO merge information, and the obtaining of the SAO on/off information may include determining a context-based probability model of the SAO on/off information, performing entropy decoding by using the determined probability model of the SAO on/off information, and thus reconstructing the SAO on/off information.
The obtaining of the absolute offset value information may include determining a context-based probability model of the absolute offset value information, performing entropy decoding without using the determined probability model of the absolute offset value information, and thus reconstructing the absolute offset value information, the obtaining of the offset sign information and the band position information may include performing entropy decoding without using a context-based probability model of the offset sign information, and thus reconstructing the offset sign information; and performing entropy decoding without using a context-based probability model of the band position information, and thus reconstructing the band position information, and the obtaining of the edge class information may include performing entropy decoding without using a context-based probability model of the edge class information, and thus reconstructing the edge class information.
According to aspects of the present disclosure, there is provided a sample adaptive offset (SAO) encoding method including outputting 1 bit of leftward SAO merge information and 1 bit of upward SAO merge information of a largest coding unit (MCU), generated by performing context encoding on each of the leftward SAO merge information and the upward SAO merge information; outputting 1 bit of SAO on/off information generated by performing context encoding on the SAO on/off information with respect to each color component; if the SAO on/off information indicates to perform SAO operation, outputting a bitstream of absolute offset value information generated by performing bypass encoding on the absolute offset value information with respect to each color component and each SAO category; and outputting a remaining bitstream generated by performing bypass encoding on one of band position information and edge class information with respect to each color component.
The outputting of the 1 bit of the SAO on/off information may include, if the SAO on/off information indicates to perform SAO operation, further outputting 1 bit of edge band identification information generated by performing bypass encoding on the edge band identification information with respect to each color component, and context encoding may be performed on the SAO on/off information in a first bin of SAO type information of the MCU, and bypass encoding may be performed on remaining bits of the SAO type information other than the SAO on/off information.
The outputting of the remaining bitstream may include, if the edge band identification information indicates a band type, outputting a bitstream of the band position information generated by performing bypass encoding on the band position information with respect to each color component, the outputting of the band position information may include, if the absolute offset value information for each SAO category is not 0, outputting the generated bitstream of the band position information and a bitstream of offset sign information generated by performing bypass encoding on the offset sign information, and the band position information may be lastly output from among SAO parameters of the MCU.
The outputting of the remaining bitstream may include, if the edge band identification information indicates an edge type, outputting a bitstream of the edge class information generated by performing bypass encoding on the edge class information with respect to each color component, and
According to aspects of the present disclosure, there is provided a sample adaptive offset (SAO) decoding apparatus including an SAO context decoder for obtaining context-encoded leftward SAO merge information and upward SAO merge information and obtaining SAO on/off information context-encoded with respect to each color component, from a bitstream of a largest coding unit (MCU); an SAO bypass decoder for, if the SAO on/off information indicates to perform SAO operation, obtaining absolute offset value information bypass-encoded with respect to each color component and each SAO category, and obtaining one of band position information and edge class information bypass-encoded with respect to each color component, from the bitstream; and an SAO operator for, if the SAO on/off information indicates to perform SAO operation, adjusting reconstructed values of the MCU for each SAO category based on the absolute offset value information by using the obtained information.
According to aspects of the present disclosure, there is provided a sample adaptive offset (SAO) encoding apparatus including an SAO operator for performing SAO operation on a largest coding unit (MCU); an SAO context encoder for generating and outputting a bitstream of leftward SAO merge information and a bitstream of upward SAO merge information of the MCU by performing context encoding on each of the leftward SAO merge information and the upward SAO merge information, and generating and outputting 1 bit of SAO on/off information by performing context encoding on the SAO on/off information with respect to each color component; and an SAO bypass encoder for, if the SAO on/off information indicates to perform SAO operation, generating and outputting a bitstream of absolute offset value information by performing bypass encoding on the absolute offset value information with respect to each color component and each SAO category, and generating and outputting a remaining bitstream by performing bypass encoding on one of band position information and edge class information with respect to each color component.
According to aspects of the present disclosure, there is provided a computer-readable recording medium having recorded thereon a computer program for executing the above method.
In methods of encoding and decoding sample adaptive offset (SAO) parameters, according to various exemplary embodiments of the present disclosure, because context encoding and context decoding are performed on only SAO merge information and SAO on/off information from among the SAO parameters, and bypass encoding and bypass decoding are performed on a remaining bitstream, a total amount of calculation for decoding the SAO parameters may be reduced.
Also, from among the SAO parameters, because some parameters are determined differently with respect to each color component and some parameters are set to be the same with respect to first and second chroma components, or with respect to luma, and first and second chroma components, a total bit length of the SAO parameters may be reduced and the amount of data to be parsed may also be reduced.
Furthermore, by reducing iterations of encoding and decoding operations, as well as reducing switching of bypass encoding and decoding operations, the efficiency of overall entropy encoding and decoding operations on the SAO parameters may be improved.